Step 1: Get Checkout URL from Your Backend
Before you can open the WePay checkout in the Android app, your backend server must generate a checkout URL.
note
The Android SDK does not call the WePay API directly. All API calls (authentication, contract creation, checkout) must be made server-side. The app only receives the final checkout URL from your backend.
What Your Backend Must Do​
Your server should perform these steps (see the Integration API docs for full details):
- Authenticate — Obtain an access token via
POST /oauth/token(Step 1 - Authentication). - Create a Contract —
POST /apps/api/contracts(Step 2 - Create Contract). - Start Checkout —
POST /apps/api/contracts/checkoutto obtain the checkout URL (Step 3 & 4 - Checkout). - Return the checkout URL to the mobile app.
Example Backend Response​
Your API endpoint should return something like:
{
"checkoutUrl": "https://pay.wepay.com/checkout?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
Example Android API Call​
Fetch the checkout URL from your backend before launching the SDK:
// Using Retrofit or your preferred HTTP client
interface YourBackendApi {
@GET("payment/checkout-url")
suspend fun getCheckoutUrl(
@Query("orderId") orderId: String
): CheckoutResponse
}
data class CheckoutResponse(val checkoutUrl: String)
// In your ViewModel or Activity
viewModelScope.launch {
val response = yourBackendApi.getCheckoutUrl(orderId = "ORDER_123")
openWePayCheckout(response.checkoutUrl)
}
Next Step​
Proceed to Step 2 — Open Checkout to launch the checkout WebView in your Android app.